<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

    <div id="con">
        <img  src="./images/animal1.png" id="img1">

    </div>

    
</body>
<script> /*  document是对整个网页文档的抽象  document.getElementById("con")
 表示在整个网页文档中，根据元素的id属性值获取到该元素的dom节点对象 */
    var con = document.getElementById("con");
    var img1 = document.getElementById("img1");

    img1.onclick = function(){
       /*  在事件的回调函数中，this指向当前触发事件的DOM对象 */
        this.style.border = "1px solid red" ;
    }
    </script>
</html>